﻿/**
 * zebron
 * 点击设备列表 关联已有设备 跳至的悬浮窗
 */

class RelateExistEquipWindow extends UiFramework.Dialog
{
    onStart(divSelf: HTMLDivElement)
    {
        let rooms = new Array("台灯   卧室", "日光灯   客厅"); // 动态数组

        // 列表 item 
        for (let i = 0; i < 2; i++)
        {
            // 条目 div
            let divItem = document.createElement("div");
            divItem.style.width = "100%";
            divItem.style.height = "66px";
            divItem.style.zIndex = "10010";
            divItem.style.backgroundColor = "#FFFFFF";
            divItem.style.borderBottom = '2px solid #95989A';
            this.divSelf.appendChild(divItem);

            // 条目名称前图标
            let imgItem = document.createElement("img");
            imgItem.src = "picture/ic_dialog.png";
            imgItem.style.paddingTop = "24px";
            imgItem.style.paddingLeft = "30px";
            divItem.appendChild(imgItem);

            // 条目名称
            let nameItem = document.createElement("nameItem");
            nameItem.style.paddingLeft = "20px";
            nameItem.textContent = rooms[i]; // 填充内容
            divItem.appendChild(nameItem);

            // 条目右箭头
            let rightArrow = document.createElement("img");
            rightArrow.src = "picture/ic_arrow_right.png";
            rightArrow.style.paddingTop = "24px";
            rightArrow.style.cssFloat = "right"; // 设置距离右边距离
            rightArrow.style.marginRight = "20px";
            divItem.appendChild(rightArrow);
        }

        // 自定义 div
        let divInput = document.createElement("div");
        divInput.style.position = "absolute";
        divInput.style.width = "100%";
        divInput.style.height = "9%";
        divInput.style.zIndex = "10001";
        divInput.style.backgroundColor = "#FFFFFF";
        divInput.style.borderBottom = '2px solid #95989A';
        this.divSelf.appendChild(divInput);

        // 完成按钮
        let btnFinish = document.createElement("input");
        btnFinish.type = "button";
        btnFinish.value = "完成";
        btnFinish.style.position = "absolute";
        btnFinish.style.left = "69%";
        btnFinish.style.marginTop = "4%";
        btnFinish.style.marginBottom = "1%";
        btnFinish.style.paddingTop = "3%";
        btnFinish.style.paddingBottom = "3%";
        btnFinish.style.paddingLeft = "9%";
        btnFinish.style.paddingRight = "9%";
        btnFinish.style.borderRadius = "2px";
        btnFinish.style.backgroundColor = "#549788";
        btnFinish.style.border = "none";
        btnFinish.style.color = "#FFFFFF";
        divInput.appendChild(btnFinish);

        //完成按钮
        btnFinish.onclick = () => {
            this.onExit();
        }

    }
}

DialogMap["relateExistEquipWindow"] = () =>
{
    return new RelateExistEquipWindow();
}